import { defineStore } from "pinia";
import type { ReportDataModel } from "@/types";

export const useDataStore = defineStore({
  id: "echartsData",

  state() {
    return {
      reportData: {} as ReportDataModel,
    };
  },

  actions: {
    // 一次性获取全部数据
    async getReportData(payload: any) {
      this.reportData = payload;
    },
    // 利用key/value去区分到底更新了哪一个数据
    updateReportData(key: string, value: any) {
      this.reportData[key] = value;
    },
  },
});
